package com.binc.testspring.vo;

import java.io.Serializable;
import java.util.List;

public class Page<T> implements Serializable {
    // @ApiModelProperty("当前页")
    private Integer pageNo;
    // @ApiModelProperty("总页数")
    private Integer totalPage;
    // @ApiModelProperty("每页最大条数")
    private Integer rowCntPerPage;
    // @ApiModelProperty("总记录数")
    private Long totalRowCount;
    // @ApiModelProperty("响应数据集")
    private List<T> list;
    // @ApiModelProperty("排序")
    private String order;
    // @ApiModelProperty("条件")
    private T condition;

    public Page() {
        this.pageNo = 1;
        this.totalPage = 1;
        this.rowCntPerPage = 10;
        this.totalRowCount = 0L;
    }

    // public Page(PageInfo pageInfo) {
    //     this.pageNo = pageInfo.getPageNum();
    //     this.totalPage = pageInfo.getPages();
    //     this.rowCntPerPage = pageInfo.getPageSize();
    //     this.totalRowCount = pageInfo.getTotal();
    //     this.list = pageInfo.getList();
    // }
    //
    // public Page(com.github.pagehelper.Page page) {
    //     this.pageNo = page.getPageNum();
    //     this.totalPage = page.getPages();
    //     this.rowCntPerPage = page.getPageSize();
    //     this.totalRowCount = page.getTotal();
    //     this.list = page.getResult();
    // }

    public Page(Page page) {
        this.pageNo = page.getPageNo();
        this.totalPage = page.getTotalPage();
        this.rowCntPerPage = page.getRowCntPerPage();
        this.totalRowCount = page.getTotalRowCount();
    }

    public Integer getPageNo() {
        return this.pageNo;
    }

    public Integer getTotalPage() {
        return this.totalPage;
    }

    public Integer getRowCntPerPage() {
        return this.rowCntPerPage;
    }

    public Long getTotalRowCount() {
        return this.totalRowCount;
    }

    public List<T> getList() {
        return this.list;
    }

    public String getOrder() {
        return this.order;
    }

    public T getCondition() {
        return this.condition;
    }

    public void setPageNo(Integer pageNo) {
        this.pageNo = pageNo;
    }

    public void setTotalPage(Integer totalPage) {
        this.totalPage = totalPage;
    }

    public void setRowCntPerPage(Integer rowCntPerPage) {
        this.rowCntPerPage = rowCntPerPage;
    }

    public void setTotalRowCount(Long totalRowCount) {
        this.totalRowCount = totalRowCount;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public void setOrder(String order) {
        this.order = order;
    }

    public void setCondition(T condition) {
        this.condition = condition;
    }

    @Override
    public boolean equals(Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof Page)) {
            return false;
        } else {
            Page<?> other = (Page)o;
            if (!other.canEqual(this)) {
                return false;
            } else {
                label95: {
                    Object this$pageNo = this.getPageNo();
                    Object other$pageNo = other.getPageNo();
                    if (this$pageNo == null) {
                        if (other$pageNo == null) {
                            break label95;
                        }
                    } else if (this$pageNo.equals(other$pageNo)) {
                        break label95;
                    }

                    return false;
                }

                Object this$totalPage = this.getTotalPage();
                Object other$totalPage = other.getTotalPage();
                if (this$totalPage == null) {
                    if (other$totalPage != null) {
                        return false;
                    }
                } else if (!this$totalPage.equals(other$totalPage)) {
                    return false;
                }

                Object this$rowCntPerPage = this.getRowCntPerPage();
                Object other$rowCntPerPage = other.getRowCntPerPage();
                if (this$rowCntPerPage == null) {
                    if (other$rowCntPerPage != null) {
                        return false;
                    }
                } else if (!this$rowCntPerPage.equals(other$rowCntPerPage)) {
                    return false;
                }

                label74: {
                    Object this$totalRowCount = this.getTotalRowCount();
                    Object other$totalRowCount = other.getTotalRowCount();
                    if (this$totalRowCount == null) {
                        if (other$totalRowCount == null) {
                            break label74;
                        }
                    } else if (this$totalRowCount.equals(other$totalRowCount)) {
                        break label74;
                    }

                    return false;
                }

                label67: {
                    Object this$list = this.getList();
                    Object other$list = other.getList();
                    if (this$list == null) {
                        if (other$list == null) {
                            break label67;
                        }
                    } else if (this$list.equals(other$list)) {
                        break label67;
                    }

                    return false;
                }

                Object this$order = this.getOrder();
                Object other$order = other.getOrder();
                if (this$order == null) {
                    if (other$order != null) {
                        return false;
                    }
                } else if (!this$order.equals(other$order)) {
                    return false;
                }

                Object this$condition = this.getCondition();
                Object other$condition = other.getCondition();
                if (this$condition == null) {
                    if (other$condition != null) {
                        return false;
                    }
                } else if (!this$condition.equals(other$condition)) {
                    return false;
                }

                return true;
            }
        }
    }

    protected boolean canEqual(Object other) {
        return other instanceof Page;
    }

    @Override
    public int hashCode() {
        boolean PRIME = true;
        int result = 1;
        Object $pageNo = this.getPageNo();
        result = result * 59 + ($pageNo == null ? 43 : $pageNo.hashCode());
        Object $totalPage = this.getTotalPage();
        result = result * 59 + ($totalPage == null ? 43 : $totalPage.hashCode());
        Object $rowCntPerPage = this.getRowCntPerPage();
        result = result * 59 + ($rowCntPerPage == null ? 43 : $rowCntPerPage.hashCode());
        Object $totalRowCount = this.getTotalRowCount();
        result = result * 59 + ($totalRowCount == null ? 43 : $totalRowCount.hashCode());
        Object $list = this.getList();
        result = result * 59 + ($list == null ? 43 : $list.hashCode());
        Object $order = this.getOrder();
        result = result * 59 + ($order == null ? 43 : $order.hashCode());
        Object $condition = this.getCondition();
        result = result * 59 + ($condition == null ? 43 : $condition.hashCode());
        return result;
    }

    @Override
    public String toString() {
        return "Page(pageNo=" + this.getPageNo() + ", totalPage=" + this.getTotalPage() + ", rowCntPerPage=" + this.getRowCntPerPage() + ", totalRowCount=" + this.getTotalRowCount() + ", list=" + this.getList() + ", order=" + this.getOrder() + ", condition=" + this.getCondition() + ")";
    }
}